﻿<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        '	Authorization level 3 needed for this function
        If Session("userLevel") < 3 Then
            Response.Redirect("/timereport/menu.aspx?msgtype=E&msgno=" & ConfigurationSettings.AppSettings("MSGNO_AUTHORIZATION_FAILED"))
        End If
    
        If (Not IsPostBack) Then
            If Len(Request.QueryString("CodiceCliente")) > 0 Then
                SchedaClienteForm.ChangeMode(FormViewMode.Edit)
                SchedaClienteForm.DefaultMode = FormViewMode.Edit
            End If
        End If
        
    End Sub
    
    Protected Sub SchedaClienteForm_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArgs)
        Response.Redirect("customer_lookup_list.aspx")
    End Sub

    Protected Sub SchedaClienteForm_ModeChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewModeEventArgs)
        If (e.CancelingEdit = True) Then
            Response.Redirect("customer_lookup_list.aspx")
        End If
    End Sub

    Protected Sub SchedaClienteForm_ItemUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewUpdatedEventArgs)
        Response.Redirect("customer_lookup_list.aspx")
    End Sub


    Protected Sub SchedaClienteForm_PageIndexChanging(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub

    Protected Sub SchedaClienteForm_PageIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub
    
    Sub ValidaCliente_ServerValidate(ByVal sender As Object, ByVal args As ServerValidateEventArgs)

        Dim c = New ValidationClass
        ' true se non esiste già il record
        args.IsValid = not c.CheckExistence("CodiceCliente", args.Value, "Customers")
        
    End Sub
    
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Crea Cliente</title>
    <link href="/timereport/include/commoncss.aspx" rel="stylesheet" type="text/css" />
</head>
<script language=JavaScript src= "/timereport/include/menu/menu_array.js" type=text/javascript></script>
<script language=JavaScript src= "/timereport/include/menu/mmenu.js" type=text/javascript></script>  

<body>
<table width="760" border="0"> 
 <tr> 
    <td height="30" class="BarraTop" align="right">Utente: <%= session("UserName") %> 
    </td>
  </tr>
</table> 
    <form id="form1" runat="server">
        <asp:FormView ID="SchedaClienteForm" runat="server" DataKeyNames="CodiceCliente" 
            DataSourceID="CustomerDataSource" DefaultMode="Insert" 
        OnItemInserted="SchedaClienteForm_ItemInserted" 
        OnModeChanging="SchedaClienteForm_ModeChanging" CssClass="DetailsView" 
        OnItemUpdated="SchedaClienteForm_ItemUpdated" >
            <EditItemTemplate>
               <table BorderStyle="Solid" BorderWidth="1px">                
                    <tr>
                        <th colspan="2">Scheda cliente</th>
                    </tr>
                    <tr>
                        <td>
                            Codice cliente:</td>
                        <td>
                            <asp:TextBox ID="CodiceClienteTextBox" runat="server" Columns="10" 
                                MaxLength="10" Text='<%# Bind("CodiceCliente") %>' Enabled="False" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ControlToValidate="CodiceClienteTextBox" Display="Dynamic" 
                                ErrorMessage="(*)"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>Nome:</td>
                        <td><asp:TextBox ID="TextBox1" runat="server" 
                    Text='<%# Bind("Nome1") %>' Columns="40" MaxLength="40" />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="(*)" ControlToValidate="TextBox1" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td>Partita Iva:</td>
                        <td><asp:TextBox ID="TextBox3" runat="server" 
                    Text='<%# Bind("PIVA") %>' Columns="13" MaxLength="13" /></td>                       
                    </tr>            
                    <tr>
                        <td>Codice Fiscale:</td>
                        <td><asp:TextBox ID="TextBox4" runat="server" 
                                    Text='<%# Bind("CodiceFiscale") %>' Columns="16" MaxLength="16" /></td>                       
                    </tr>                               
                    <tr>
                        <td>Attivo:</td>
                        <td><asp:CheckBox ID="FlagAttivoCheckBox" runat="server" 
                                    Checked='<%# Bind("FlagAttivo") %>' /></td>                       
                    </tr>                                             
                    <tr> 
                                            <td>Metodo di pagamento</td>
                        <td>
                            <asp:DropDownList ID="DropDownList1" runat="server" 
                                DataSourceID="metododipagamento" DataTextField="Descrizione"  AppendDataBoundItems="True" 
                                DataValueField="MetodoPagamento" 
                                SelectedValue='<%# Bind("MetodoPagamento") %>' Width="200px">
                                <asp:ListItem  Value="" Text="Selezionare un valore"/>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="metododipagamento" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:MSSql12155ConnectionString %>" 
                                SelectCommand="SELECT * FROM [MetodoPagamento]"></asp:SqlDataSource>
                                            </td>                       
                    </tr>                    
                    <tr>
                                            <td>Termini di pagamento</td>
                        <td>
                            <asp:DropDownList ID="DropDownList2" runat="server" 
                                DataSourceID="terminidipagamento" DataTextField="Descrizione" 
                                DataValueField="TerminiPagamento"  AppendDataBoundItems="True" 
                                SelectedValue='<%# Bind("TerminiPagamento") %>' Width="200px">
                                <asp:ListItem  Value="" Text="Selezionare un valore"/>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="terminidipagamento" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:MSSql12155ConnectionString %>" 
                                SelectCommand="SELECT * FROM [TerminiPagamento]"></asp:SqlDataSource>
                                            </td>                       
                    </tr>                    
                      <tr>
                                            <td>Manager</td>
                        <td>
                            <asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="Manager" 
                                DataTextField="Name" DataValueField="Persons_id"  AppendDataBoundItems="True" 
                                SelectedValue='<%# Bind("ClientManager_id") %>' Width="200px">
                                <asp:ListItem  Value="" Text="Selezionare un valore"/>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="(*)" ControlToValidate="DropDownList3" Display="Dynamic"></asp:RequiredFieldValidator>
                            <asp:SqlDataSource ID="Manager" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:MSSql12155ConnectionString %>" 
                                
                                SelectCommand="SELECT [Persons_id], [Name] FROM [Persons] WHERE ([Active] = @Active)">
                                <SelectParameters>
                                    <asp:Parameter DefaultValue="true" Name="Active" Type="Boolean" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                                            </td>                       
                    </tr>   
                    <tr>
                        <td colspan="2">&nbsp;</td>
                    </tr>                    
                    <tr>
                        <th colspan="2">
                            Sede Legale</th>
                    </tr>
                    <tr>
                        <td>
                            Via</td>
                        <td>
                            <asp:TextBox ID="TextBox5" runat="server" 
                                text='<%# Bind("SedeLegaleVia1") %>' Columns="40" MaxLength="50" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Città:</td>
                        <td>
                            <asp:TextBox ID="TextBox9" runat="server" 
                                Text='<%# Bind("SedeLegaleCitta") %>' Columns="30" MaxLength="30" />
                        </td>
                    </tr>
                    <tr> 
                                            <td>CAP:</td>
                        <td><asp:TextBox ID="TextBox8" runat="server" 
                                    Text='<%# Bind("SedeLegaleCAP") %>' Columns="10" MaxLength="10" />
                            &nbsp;Provincia:&nbsp;<asp:TextBox ID="TextBox7" runat="server" Columns="3" MaxLength="3" 
                                Text='<%# Bind("SedeLegaleProv") %>' />
                                            </td>                       
                    </tr>                                     
                    <tr> 
                                            <td>Nazione</td>
                        <td><asp:TextBox ID="TextBox10" Text='<%# Bind("SedeLegaleNazione")  %>' runat="server" Columns="20" MaxLength="20" /></td>                       
                    </tr>                                            
                    <tr>
                        <td colspan="2" style="font-weight: 700">&nbsp;</td>
                    </tr>                    
                    <tr>
                        <th colspan="2" >
                            Sede Operativa</th>
                    </tr>
                    <tr>
                        <td>
                            Via</td>
                        <td>
                            <asp:TextBox ID="TextBox13" runat="server" 
                                Text='<%# Bind("SedeOperativaVia1") %>' Columns="40" MaxLength="50" />
                        </td>
                    </tr>
                    <tr> 
                                            <td>Città:</td>
                        <td>
                            <asp:TextBox ID="TextBox17" runat="server" 
                                    Text='<%# Bind("SedeOperativaCitta") %>' Columns="30" MaxLength="30" /></td>                       
                    </tr>                    
                    <tr> 
                                            <td>CAP:</td>
                        <td><asp:TextBox ID="TextBox16" runat="server" 
                                    Text='<%# Bind("SedeOperativaCAP") %>' Columns="10" MaxLength="10" />
                            &nbsp;Provincia:&nbsp;
                            <asp:TextBox ID="TextBox15" runat="server" Columns="3" MaxLength="3" 
                                Text='<%# Bind("SedeOperativaProv") %>' />
                                            </td>                       
                    </tr>                                                                                 
                    <tr> 
                                            <td>Nazione</td>
                        <td><asp:TextBox ID="TextBox18" runat="server" 
                                    Text='<%# Bind("SedeOperativaNazione") %>' Columns="20" 
                                MaxLength="20" /></td>                       
                    </tr> 
                    </table>                                        
                      <table class="DetailsViewNote" width="300px">
                        <tr><th>Note</td></tr>
                        <tr><td align="center">
                        <asp:TextBox ID="TextBox22" Text='<%# Bind("Note") %>' runat="server" Columns="30" Rows="20" 
                                TextMode="MultiLine" />                       
                    </td></tr>
                    </table>  
                <br />
                <asp:Button ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" CssClass="FormButton" Text="Update" />
                &nbsp;<asp:Button ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" CssClass="FormButton"  Text="Cancel" />
            </EditItemTemplate>
            <InsertItemTemplate>
                <table BorderStyle="Solid" BorderWidth="1px">                
                    <tr>
                        <th colspan="2">Scheda cliente</th>
                    </tr>
                    <tr>
                        <td>
                            Codice cliente:</td>
                        <td>
                            <asp:TextBox ID="CodiceClienteTextBox" runat="server" Columns="10" 
                                MaxLength="10" Text='<%# Bind("CodiceCliente") %>' />
                            <asp:CustomValidator ID="ValidaCliente" runat="server" ErrorMessage="Codice cliente già esistente" OnServerValidate="ValidaCliente_ServerValidate" ControlToValidate="CodiceClienteTextBox"></asp:CustomValidator>   
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ControlToValidate="CodiceClienteTextBox" Display="Dynamic" 
                                ErrorMessage="(*)"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>Nome:</td>
                        <td><asp:TextBox ID="TextBox1" runat="server" 
                    Text='<%# Bind("Nome1") %>' Columns="40" MaxLength="40" />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="(*)" ControlToValidate="TextBox1" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td>Partita Iva:</td>
                        <td><asp:TextBox ID="TextBox3" runat="server" 
                    Text='<%# Bind("PIVA") %>' Columns="13" MaxLength="13" /></td>                       
                    </tr>            
                    <tr>
                        <td>Codice Fiscale:</td>
                        <td><asp:TextBox ID="TextBox4" runat="server" 
                                    Text='<%# Bind("CodiceFiscale") %>' Columns="16" MaxLength="16" /></td>                       
                    </tr>                               
                    <tr>
                        <td>Attivo:</td>
                        <td><asp:CheckBox ID="FlagAttivoCheckBox" runat="server" 
                                    Checked='<%# Bind("FlagAttivo") %>' /></td>                       
                    </tr>                                             
                    <tr> 
                                            <td>Metodo di pagamento</td>
                        <td>
                            <asp:DropDownList ID="DropDownList1" runat="server" 
                                DataSourceID="metododipagamento" DataTextField="Descrizione"  AppendDataBoundItems="True" 
                                DataValueField="MetodoPagamento" 
                                SelectedValue='<%# Bind("MetodoPagamento") %>' Width="200px">
                                <asp:ListItem  Value="" Text="Selezionare un valore"/>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="metododipagamento" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:MSSql12155ConnectionString %>" 
                                SelectCommand="SELECT * FROM [MetodoPagamento]"></asp:SqlDataSource>
                                            </td>                       
                    </tr>                    
                    <tr>
                                            <td>Termini di pagamento</td>
                        <td>
                            <asp:DropDownList ID="DropDownList2" runat="server" 
                                DataSourceID="terminidipagamento" DataTextField="Descrizione" 
                                DataValueField="TerminiPagamento"  AppendDataBoundItems="True" 
                                SelectedValue='<%# Bind("TerminiPagamento") %>' Width="200px">
                                <asp:ListItem  Value="" Text="Selezionare un valore"/>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="terminidipagamento" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:MSSql12155ConnectionString %>" 
                                SelectCommand="SELECT * FROM [TerminiPagamento]"></asp:SqlDataSource>
                                            </td>                       
                    </tr>                    
                      <tr>
                                            <td>Manager</td>
                        <td>
                            <asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="Manager" 
                                DataTextField="Name" DataValueField="Persons_id"  AppendDataBoundItems="True" 
                                SelectedValue='<%# Bind("ClientManager_id") %>' Width="200px">
                                <asp:ListItem  Value="" Text="Selezionare un valore"/>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="(*)" ControlToValidate="DropDownList3" Display="Dynamic"></asp:RequiredFieldValidator>
                            <asp:SqlDataSource ID="Manager" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:MSSql12155ConnectionString %>" 
                                
                                SelectCommand="SELECT [Persons_id], [Name] FROM [Persons] WHERE ([Active] = @Active)">
                                <SelectParameters>
                                    <asp:Parameter DefaultValue="true" Name="Active" Type="Boolean" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                                            </td>                       
                    </tr>   
                    <tr>
                        <td colspan="2">&nbsp;</td>
                    </tr>                    
                    <tr>
                        <th colspan="2">
                            Sede Legale</th>
                    </tr>
                    <tr>
                        <td>
                            Via</td>
                        <td>
                            <asp:TextBox ID="TextBox5" runat="server" 
                                text='<%# Bind("SedeLegaleVia1") %>' Columns="40" MaxLength="50" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Città:</td>
                        <td>
                            <asp:TextBox ID="TextBox9" runat="server" 
                                Text='<%# Bind("SedeLegaleCitta") %>' Columns="30" MaxLength="30" />
                        </td>
                    </tr>
                    <tr> 
                                            <td>CAP:</td>
                        <td><asp:TextBox ID="TextBox8" runat="server" 
                                    Text='<%# Bind("SedeLegaleCAP") %>' Columns="10" MaxLength="10" />
                            &nbsp;Provincia:&nbsp;<asp:TextBox ID="TextBox7" runat="server" Columns="3" MaxLength="3" 
                                Text='<%# Bind("SedeLegaleProv") %>' />
                                            </td>                       
                    </tr>                                     
                    <tr> 
                                            <td>Nazione</td>
                        <td><asp:TextBox ID="TextBox10" runat="server" Columns="20" MaxLength="20" /></td>                       
                    </tr>                                            
                    <tr>
                        <td colspan="2" style="font-weight: 700">&nbsp;</td>
                    </tr>                    
                    <tr>
                        <th colspan="2" >
                            Sede Operativa</th>
                    </tr>
                    <tr>
                        <td>
                            Via</td>
                        <td>
                            <asp:TextBox ID="TextBox13" runat="server" 
                                Text='<%# Bind("SedeOperativaVia1") %>' Columns="40" MaxLength="50" />
                        </td>
                    </tr>
                    <tr> 
                                            <td>Città:</td>
                        <td>
                            <asp:TextBox ID="TextBox17" runat="server" 
                                    Text='<%# Bind("SedeOperativaCitta") %>' Columns="30" MaxLength="30" /></td>                       
                    </tr>                    
                    <tr> 
                                            <td>CAP:</td>
                        <td><asp:TextBox ID="TextBox16" runat="server" 
                                    Text='<%# Bind("SedeOperativaCAP") %>' Columns="10" MaxLength="10" />
                            &nbsp;Provincia:&nbsp;
                            <asp:TextBox ID="TextBox15" runat="server" Columns="3" MaxLength="3" 
                                Text='<%# Bind("SedeOperativaProv") %>' />
                                            </td>                       
                    </tr>                                                                                 
                    <tr> 
                                            <td>Nazione</td>
                        <td><asp:TextBox ID="TextBox18" runat="server" 
                                    Text='<%# Bind("SedeOperativaNazione") %>' Columns="20" 
                                MaxLength="20" /></td>                       
                    </tr> 
                    </table>                                        
                      <table class="DetailsViewNote" width="300px">
                        <tr><th colspan="2">Note</td></tr>
                        <tr><td align="center">
                        <asp:TextBox ID="TextBox22" Text='<%# Bind("Note") %>' runat="server" Columns="30" Rows="20" 
                                TextMode="MultiLine" />                       
                    </td></tr>
                    </table>  
                        <br />
                                <asp:Button ID="InsertButton" runat="server" CausesValidation="True" 
                                    CommandName="Insert" Text="Insert" CssClass="FormButton" />
                                &nbsp;<asp:Button ID="InsertCancelButton" runat="server" 
                                    CausesValidation="False" CommandName="Cancel" Text="Cancel" 
                                    CssClass="FormButton" />

            </InsertItemTemplate>
            <ItemTemplate>
                Codice Cliente:
                <asp:Label ID="CodiceClienteLabel" runat="server" 
                    Text='<%# Bind("CodiceCliente") %>' />
                <br />
                Nome1:
                <asp:Label ID="Nome1Label" runat="server" Text='<%# Bind("Nome1") %>' />
                <br />
                PIVA:
                <asp:Label ID="PIVALabel" runat="server" Text='<%# Bind("PIVA") %>' />
                <br />
                FlagAttivo:
                <asp:CheckBox ID="FlagAttivoCheckBox" runat="server" 
                    Checked='<%# Bind("FlagAttivo") %>' Enabled="false" />
                <br />
                CodiceFiscale:
                <asp:Label ID="CodiceFiscaleLabel" runat="server" 
                    Text='<%# Bind("CodiceFiscale") %>' />
                <br />
                SedeLegaleVia1:
                <asp:Label ID="SedeLegaleVia1Label" runat="server" 
                    Text='<%# Bind("SedeLegaleVia1") %>' />
                <br />
                SedeLegaleCitta:
                <asp:Label ID="SedeLegaleCittaLabel" runat="server" 
                    Text='<%# Bind("SedeLegaleCitta") %>' />
                <br />
                SedeLegaleProv:
                <asp:Label ID="SedeLegaleProvLabel" runat="server" 
                    Text='<%# Bind("SedeLegaleProv") %>' />
                <br />
                SedeLegaleCAP:
                <asp:Label ID="SedeLegaleCAPLabel" runat="server" 
                    Text='<%# Bind("SedeLegaleCAP") %>' />
                <br />
                SedeLegaleNazione:
                <asp:Label ID="SedeLegaleNazioneLabel" runat="server" 
                    Text='<%# Bind("SedeLegaleNazione") %>' />
                <br />
                SedeOperativaVia1:
                <asp:Label ID="SedeOperativaVia1Label" runat="server" 
                    Text='<%# Bind("SedeOperativaVia1") %>' />
                <br />
                SedeOperativaVia2:
                <asp:Label ID="SedeOperativaVia2Label" runat="server" 
                    Text='<%# Bind("SedeOperativaVia2") %>' />
                <br />
                SedeOperativaCitta:
                <asp:Label ID="SedeOperativaCittaLabel" runat="server" 
                    Text='<%# Bind("SedeOperativaCitta") %>' />
                <br />
                SedeOperativaProv:
                <asp:Label ID="SedeOperativaProvLabel" runat="server" 
                    Text='<%# Bind("SedeOperativaProv") %>' />
                <br />
                SedeOperativaCAP:
                <asp:Label ID="SedeOperativaCAPLabel" runat="server" 
                    Text='<%# Bind("SedeOperativaCAP") %>' />
                <br />
                SedeOperativaNazione:
                <asp:Label ID="SedeOperativaNazioneLabel" runat="server" 
                    Text='<%# Bind("SedeOperativaNazione") %>' />
                <br />
                MetodoPagamento:
                <asp:Label ID="MetodoPagamentoLabel" runat="server" 
                    Text='<%# Bind("MetodoPagamento") %>' />
                <br />
                TerminiPagamento:
                <asp:Label ID="TerminiPagamentoLabel" runat="server" 
                    Text='<%# Bind("TerminiPagamento") %>' />
                <br />
                ClientManager_id:
                <asp:Label ID="ClientManager_idLabel" runat="server" 
                    Text='<%# Bind("ClientManager_id") %>' />
                <br />
                Note:
                <asp:Label ID="NoteLabel" runat="server" Text='<%# Bind("Note") %>' />
                <br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Edit" />
                &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="Delete" />
                &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                    CommandName="New" Text="New" />
            </ItemTemplate>
        </asp:FormView>
        <asp:SqlDataSource ID="CustomerDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MSSql12155ConnectionString %>" 
            DeleteCommand="DELETE FROM [Customers] WHERE [CodiceCliente] = @CodiceCliente" 
            InsertCommand="INSERT INTO [Customers] ([CodiceCliente], [Nome1], [PIVA], [FlagAttivo], [CodiceFiscale], [SedeLegaleVia1], [SedeLegaleCitta], [SedeLegaleProv], [SedeLegaleCAP], [SedeLegaleNazione], [SedeOperativaVia1], [SedeOperativaCitta], [SedeOperativaProv], [SedeOperativaCAP], [SedeOperativaNazione], [MetodoPagamento], [TerminiPagamento], [ClientManager_id], [Note]) VALUES (@CodiceCliente, @Nome1, @PIVA, @FlagAttivo, @CodiceFiscale, @SedeLegaleVia1, @SedeLegaleCitta, @SedeLegaleProv, @SedeLegaleCAP, @SedeLegaleNazione, @SedeOperativaVia1, @SedeOperativaCitta, @SedeOperativaProv, @SedeOperativaCAP, @SedeOperativaNazione, @MetodoPagamento, @TerminiPagamento, @ClientManager_id, @Note)" 
            SelectCommand="SELECT * FROM [Customers] WHERE ([CodiceCliente] = @CodiceCliente)" 
            UpdateCommand="UPDATE [Customers] SET [Nome1] = @Nome1, [PIVA] = @PIVA, [FlagAttivo] = @FlagAttivo, [CodiceFiscale] = @CodiceFiscale, [SedeLegaleVia1] = @SedeLegaleVia1, [SedeLegaleCitta] = @SedeLegaleCitta, [SedeLegaleProv] = @SedeLegaleProv, [SedeLegaleCAP] = @SedeLegaleCAP, [SedeLegaleNazione] = @SedeLegaleNazione, [SedeOperativaVia1] = @SedeOperativaVia1, [SedeOperativaCitta] = @SedeOperativaCitta, [SedeOperativaProv] = @SedeOperativaProv, [SedeOperativaCAP] = @SedeOperativaCAP, [SedeOperativaNazione] = @SedeOperativaNazione, [MetodoPagamento] = @MetodoPagamento, [TerminiPagamento] = @TerminiPagamento, [ClientManager_id] = @ClientManager_id, [Note] = @Note WHERE [CodiceCliente] = @CodiceCliente">
            <SelectParameters>
                <asp:QueryStringParameter Name="CodiceCliente" 
                    QueryStringField="CodiceCliente" Type="String" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="CodiceCliente" Type="String" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Nome1" Type="String" />
                <asp:Parameter Name="PIVA" Type="String" />
                <asp:Parameter Name="FlagAttivo" Type="Boolean" />
                <asp:Parameter Name="CodiceFiscale" Type="String" />
                <asp:Parameter Name="SedeLegaleVia1" Type="String" />
                <asp:Parameter Name="SedeLegaleCitta" Type="String" />
                <asp:Parameter Name="SedeLegaleProv" Type="String" />
                <asp:Parameter Name="SedeLegaleCAP" Type="String" />
                <asp:Parameter Name="SedeLegaleNazione" Type="String" />
                <asp:Parameter Name="SedeOperativaVia1" Type="String" />
                <asp:Parameter Name="SedeOperativaCitta" Type="String" />
                <asp:Parameter Name="SedeOperativaProv" Type="String" />
                <asp:Parameter Name="SedeOperativaCAP" Type="String" />
                <asp:Parameter Name="SedeOperativaNazione" Type="String" />
                <asp:Parameter Name="MetodoPagamento" Type="String" />
                <asp:Parameter Name="TerminiPagamento" Type="String" />
                <asp:Parameter Name="ClientManager_id" Type="Int32" />
                <asp:Parameter Name="Note" Type="String" />
                <asp:Parameter Name="CodiceCliente" Type="String" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="CodiceCliente" Type="String" />
                <asp:Parameter Name="Nome1" Type="String" />
                <asp:Parameter Name="PIVA" Type="String" />
                <asp:Parameter Name="FlagAttivo" Type="Boolean" />
                <asp:Parameter Name="CodiceFiscale" Type="String" />
                <asp:Parameter Name="SedeLegaleVia1" Type="String" />
                <asp:Parameter Name="SedeLegaleCitta" Type="String" />
                <asp:Parameter Name="SedeLegaleProv" Type="String" />
                <asp:Parameter Name="SedeLegaleCAP" Type="String" />
                <asp:Parameter Name="SedeLegaleNazione" Type="String" />
                <asp:Parameter Name="SedeOperativaVia1" Type="String" />
                <asp:Parameter Name="SedeOperativaCitta" Type="String" />
                <asp:Parameter Name="SedeOperativaProv" Type="String" />
                <asp:Parameter Name="SedeOperativaCAP" Type="String" />
                <asp:Parameter Name="SedeOperativaNazione" Type="String" />
                <asp:Parameter Name="MetodoPagamento" Type="String" />
                <asp:Parameter Name="TerminiPagamento" Type="String" />
                <asp:Parameter Name="ClientManager_id" Type="Int32" />
                <asp:Parameter Name="Note" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
    </form>
</body>
</html>
